class joinModel{
  constructor(){
    this.db = require('../../config/db')
  }
  //获取所有报名信息
  joinInfo(){
    let sql = 'select * from joines order by pubdate DESC'
    return this.db.query(sql)
  }
  //报名信息分页
  pageJoin(pagenum,per_page){
    let sql = 'select * from joines order by pubdate DESC limit ?,?'
    return this.db.query(sql,[pagenum,per_page])
  }

  //添加报名信息
  addJoin(phone,name,email){
    let sql = 'insert into joines (phone,name,email) values(?,?,?)'
    return this.db.query(sql,[phone,name,email])
  }
}

module.exports = new joinModel()